// Copyright (c) 2007-2008, 
// Trevor McCauley, http://www.senocular.com, 
// Alessandro Crugnola, http://www.sephiroth.it,
// Marc Speck, http://www.faindu.com
// All Rights Reserved. The following is Source Code and is subject to all restrictions 
// on such code as contained in the license accompanying this product.
package com.faindu.editImage.base
{
import flash.events.Event;
import flash.geom.Point;

/**
 * EditImage throws this event for launching the interaction handlers in the different
 * tools. 
 */
public class EditImageEvent extends Event
{
	/**
	 * Constructor
	 */
	public function EditImageEvent(
			type:String, 
			shiftKey:Boolean = false,
			mousePosition:Point = null
			)
	{
		super( type, false, false )
		
		this.shiftKey = shiftKey
		this.mousePosition = mousePosition
	}
	
	//--------------------------------------------------------------------------
    //
    //  Constants
    //
    //--------------------------------------------------------------------------	
    /**
     *  The <code>EditImageEvent.CONTROL_DOWN</code> constant defines the value of the
     *  <code>type</code> property of the event object for a <code>controlDown</code> event.
     *
     *  <p>The properties of the event object have the following values:</p>
     *  <table class="innertable">
     *     <tr><th>Property</th><th>Value</th></tr>
     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
     *     <tr><td><code>currentTarget</code></td><td>The control of a tool that defines the
     *       event listener that handles the event. The control normaly extends  
     *       <code>BaseControl</code> and is for example <code>ScaleControl</code>.</td></tr>
     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
     *       it is not always the Object listening for the event.
     *       Use the <code>currentTarget</code> property to always access the
     *       Object listening for the event.</td></tr>
     *     <tr><td><code>shiftKey</code></td><td>Whether the Shift key is down.</td></tr>
     *  </table>
     * 
     *  @see com.faindu.editImage.base.BaseControl
     *  @see com.faindu.editImage.scale.ScaleControl
     *  @eventType com.faindu.editImage.base.EditImageEvent.controlDown
     */
	public static const CONTROL_DOWN: String = "com.faindu.editImage.base.EditImageEvent.controlDown"

    /**
     *  The <code>EditImageEvent.CONTROL_MOVE</code> constant defines the value of the
     *  <code>type</code> property of the event object for a <code>controlMove</code> event.
     *
     *  <p>The properties of the event object have the following values:</p>
     *  <table class="innertable">
     *     <tr><th>Property</th><th>Value</th></tr>
     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
     *     <tr><td><code>currentTarget</code></td><td>The control of a tool that defines the
     *       event listener that handles the event. The control normaly extends  
     *       <code>BaseControl</code> and is for example <code>ScaleControl</code>.</td></tr>
     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
     *       it is not always the Object listening for the event.
     *       Use the <code>currentTarget</code> property to always access the
     *       Object listening for the event.</td></tr>
     *     <tr><td><code>shiftKey</code></td><td>Whether the Shift key is down.</td></tr>
     *  </table>
     * 
     *  @see com.faindu.editImage.base.BaseControl
     *  @see com.faindu.editImage.scale.ScaleControl
     *  @eventType com.faindu.editImage.base.EditImageEvent.controlMove
     */
	public static const CONTROL_MOVE: String = "com.faindu.editImage.base.EditImageEvent.controlMove"
	
	//--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------	
	/**
	 * True if the shift key is currently pressed.
	 */
	public var shiftKey: Boolean

	/**
	 * The current position of the mouse.
	 */
	public var mousePosition: Point
	
	//--------------------------------------------------------------------------
    //
    //  Overriden method
    //
    //--------------------------------------------------------------------------		
	public override function clone(): Event
	{
		var clonedMousePosition: Point = mousePosition ? mousePosition.clone() : null
		return new EditImageEvent( type, shiftKey, clonedMousePosition )
	}			
}
}